<template>
  <a-modal :title="title"
           :width="1200"
           :visible="listVisible"
           @ok="handleCancel"
           @cancel="listVisible=false"
           cancelText="关闭"
  >

    <a-card :bordered="false">

      <!-- table区域 -->
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="orderInfo"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">



          <span slot="action" slot-scope="text, record" >

            <a @click="handleOrderIndex(record)">事件记录</a>
<!--                <a-divider type="vertical" />-->
<!--              <a @click="handlePatienData(record)">详情</a>-->
        </span>
      </a-table>
      <order-index-modal ref="orderIndexModal"></order-index-modal>
    </a-card>
  </a-modal>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { mixinDevice } from '@/utils/mixin'
import PatientDataModal from '../../patient/modules/PatientDataModal'
import { getAction } from '@api/manage'
import OrderIndexModal from '@/views/order/modules/OrderIndexModal'

export default {
name: "OrderInfoModal",

  mixins:[JeecgListMixin, mixinDevice],
  components: {
    PatientDataModal,
    OrderIndexModal

  },
  data () {
    return {
      description: 'doctor_assistant管理页面',
      title:"详情",
      listVisible:false,
      labelCol: {
        xs: { span: 8 },
        sm: { span: 8 },
      },
      wrapperCol: {
        xs: { span: 20 },
        sm: { span: 16 },
      },
      orderInfo:{},
      columns: [
        {
          title:'订单编号',
          align:"center",
          dataIndex: 'id'
        },
        {
          title:'医生名称',
          align:"center",
          dataIndex: 'doctorName'
        },
        {
          title:'创建时间',
          align:"center",
          dataIndex: 'createTime'
        },
        {
          title:'订单类型',
          align:"center",
          dataIndex: 'shopType',
          customRender:function (res) {
            let type;
            if(res == 1){
              type = "图文问诊";
            }else if(res == 2){
              type = "视频问诊";
            }
            return type;
          }
        },
        {
          title:'订单状态',
          align:"center",
          dataIndex: 'status',
          customRender:function (res) {
            let status;
            if(res == 0){
              status = "待接诊";
            }else if(res == 1){
              status = "进行中";
            }else if(res == 2){
              status = "确认中";
            } else if(res == 3){
              status = "结算中";
            } else if(res == 4){
              status = "已结算";
            }else if(res == 5){
              status = "退款";
            }else if(res == 6){
              status = "关闭";
            }
            return status;
          }
        },
        {
          title:'订单用户',
          align:"center",
          dataIndex: 'userName'
        },
        {
          title:'订单金额',
          align:"center",
          dataIndex: 'amount',
        },
        {
          title: '订单进度表',
          dataIndex: 'action',
          align:"center",
          fixed:"right",
          width:147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/doctor/doctorAssistantRelation/doctorList",
        queryById: "/order/order/queryById",

      },

    }
  },
  created() {
    this.showSettlement();
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    initDictConfig(){
    },
    showOrderInfo(record){

      let param = {};

      param.id = record.id;

      getAction(this.url.queryById,param).then(res=>{
        this.orderInfo = res.result;
      })
      this.listVisible = true;
    },
    handleCancel(){
      this.listVisible = false;
    },
    handleOrderIndex(record){
      this.$refs.orderIndexModal.showOrderIndex(record);
    }

  }


}
</script>

<style scoped>
@import '~@assets/less/common.less';
</style>